package z.t.b.db.meta;

import z.t.b.db.meta.mysql.MysqlMetadataLoader;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * xx
 *
 * @Description TODO
 * @Author ztb
 * @Date 2024/3/23 17:47
 * @Version 1.0
 */
public class MetadataLoaderFactory {

    private final static Map<String, MetadataLoader> loaderMap = new ConcurrentHashMap<>();

    static {
        loaderMap.put("mysql", new MysqlMetadataLoader());
    }

    /**
     *
     * @param dbType
     * @return
     */
    public static MetadataLoader getMetadataLoader(String dbType){
        MetadataLoader metadataLoader = loaderMap.get(dbType);
        if(metadataLoader == null){
            throw new RuntimeException("不支持的数据库类型："+dbType);
        }
        return metadataLoader;
    }
}
